# # 队列，中间人
# class Broker(object):
#     # 任务队列
#     broker_list = []
#
# # 消费者
# class Worker(object):
#     # 任务执行者
#
#     def run(self, broker, func):
#         if func in broker.broker_list:
#             func()
#         else:
#             return 'error'
#
# # Celery 将这3者 串联起来了
# class Celery(object):
#     def __init__(self):
#         self.broker = Broker()
#         self.worker = Worker()
#
#     def add(self, func):
#         self.broker.broker_list.append(func)
#
#     def work(self, func):
#         self.worker.run(self.broker,func)
#
#
# # 任务（函数），生产者
# def send_sms_code():
#     print('send_sms_code')
#
# # 1.创建celery实例
# app=Celery()
# # 2. 添加任务
# app.add(send_sms_code)
# # 3.执行任务
# app.work(send_sms_code)
#

# str1='abcde'
# print(hasattr(str1, 'isdigit'))  #在对象里找有没有属性或方法名,返回值是布尔型
#
# # print(getattr(str1, 'count'))  #在对象里找有没有属性或方法名,如果能找到,返回找到的属性或方法
#
# print("--------")
# str1_count = getattr(str1, 'count1', 2)
# if str1_count:
#     print(str1_count)
#
# print(getattr(str1, 'isdigit123', '未找到该方法或属性'))